package com.cos66.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelp extends SQLiteOpenHelper {

	private static final String TAG = "DatabaseHelp";
	private static final int DEFUALT_VERSION = 1;
	private static final String SQL_CREATE_TABLE = "CREATE TABLE downloadinfo ( " +
			"id INT NOT NULL, fatherid INT NOT NULL, url VARCHAR(80) NOT NULL, describiton VARCHAR(45) NOT NULL, " +
			"isdownload INT DEFAULT '0' NOT NULL, bak VARCHAR(45) , PRIMARY KEY (id) )";

	public DatabaseHelp(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	public DatabaseHelp(Context context, String name, int version) {
		this(context, name, null, version);
	}

	public DatabaseHelp(Context context, String name) {
		this(context, name, DEFUALT_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(SQL_CREATE_TABLE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		Log.i(TAG, "UPDATA DATABASE");
	}

}
